1 module derelict.jwt.jwt; 2 3 public { 4 import derelict.jwt.jwttypes; 5 import derelict.jwt.jwtfuncs; 6 } 7 8 private { 9 import derelict.util.loader; 10 import derelict.util.system; 11 12 static if(Derelict_OS_Windows) 13 enum libNames = "libjwt.dll"; 14 else static if(Derelict_OS_Linux) 15 enum libNames = "libjwt.so"; 16 else static if(Derelict_OS_Mac) 17 enum libNames = "libjwt.dylib"; 18 else 19 static assert(0, "Need to implement libjwt libNames for this operating system."); 20 } 21 22 class DerelictJWTLoader : SharedLibLoader { 23 public this() { 24 super(libNames); 25 } 26 27 protected { 28 override void loadSymbols() { 29 bindFunc(cast(void**)&jwt_new, "jwt_new"); 30 bindFunc(cast(void**)&jwt_decode, "jwt_decode"); 31 bindFunc(cast(void**) &jwt_free, "jwt_free"); 32 bindFunc(cast(void**) &jwt_dup, "jwt_dup"); 33 bindFunc(cast(void**) &jwt_get_grant, "jwt_get_grant"); 34 bindFunc(cast(void**) &jwt_get_grant_int, "jwt_get_grant_int"); 35 bindFunc(cast(void**) &jwt_get_grants_json, "jwt_get_grants_json"); 36 bindFunc(cast(void**) &jwt_add_grant, "jwt_add_grant"); 37 bindFunc(cast(void**) &jwt_add_grants_json, "jwt_add_grants_json"); 38 bindFunc(cast(void**) &jwt_del_grants, "jwt_del_grants"); 39 version(DerelictJWT_Load_Deprecated) { 40 bindFunc(cast(void**) &jwt_del_grant, "jwt_del_grant"); 41 } 42 bindFunc(cast(void**) &jwt_dump_fp, "jwt_dump_fp"); 43 bindFunc(cast(void**) &jwt_dump_str, "jwt_dump_str"); 44 bindFunc(cast(void**) &jwt_encode_fp, "jwt_encode_fp"); 45 bindFunc(cast(void**) &jwt_encode_str, "jwt_encode_str"); 46 bindFunc(cast(void**) &jwt_set_alg, "jwt_set_alg"); 47 bindFunc(cast(void**) &jwt_get_alg, "jwt_get_alg"); 48 } 49 } 50 } 51 52 __gshared DerelictJWTLoader DerelictJWT; 53 54 shared static this() { 55 DerelictJWT = new DerelictJWTLoader(); 56 }